home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / thirtnth.wrl < prev    next >
Text File  |  1995-06-14  |  3KB  |  102 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example thirteen - We're lighting our Sun, it illuminates the Earth and Moon
  4. # Here comes the Sun
  5. # The Separator node groups everything within it together
  6. DEF SOLAR_SYSTEM Separator {
  7.  
  8.     # The material will effect all subsequent nodes
  9.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  10.     # We're switching to emissive color because the Sun gives off light.
  11.     Material {
  12.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  13.     }
  14.  
  15.     # We'll make the Sun shine here
  16.     # A PointLight shines equally in all directions, like the Sun does.
  17.     DEF SUNLIGHT PointLight {
  18.         intensity 1        # The Sun is way bright
  19.         color 1 1 0.9   # Sunlight is basically white, even though the Sun is yellow.
  20.     }
  21.  
  22.     # The WWWAnchor node is a group node
  23.     # This means that all objects within it are linked with the anchor's URL
  24.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  25.     # Using the description field, we provide context for the user
  26.     # The DEF node attaches the name "SUN" to the WWWAnchor group
  27.     DEF SUN WWWAnchor {
  28.         name "http://www.w3.org/" # The root URL of the World Wide Web
  29.         description "A link from the Sun to W3.ORG" # Decriptive text
  30.  
  31.         # Inside the anchor, because WWWAnchor is a group node
  32.         Sphere {
  33.             radius 10        # Big Sun
  34.         }
  35.     }
  36.  
  37.     # We place the Earth within it's own Separator
  38.     # To keep everything good and isolated
  39.     Separator {
  40.  
  41.         # Let's move things out of the way here
  42.         Transform {
  43.             translation 0 20 20
  44.         }
  45.  
  46.         # Color the Earth blue, and make it absorb light
  47.         # But also make it a reflective, like water
  48.         Material {
  49.             diffuseColor 0 0 1 # Big blue marble
  50.             shininess 0.9 # Water is rather shiny
  51.         }
  52.  
  53.         # The WWWAnchor node is a group node
  54.         # This means that all objects within it are linked with the anchor's URL
  55.         # We want to link the Earth, so the Earth's Sphere node goes inside of it.
  56.         # Using the description field, we provide context for the user
  57.         # The DEF node attaches the name "Earth" to the WWWAnchor node
  58.         DEF EARTH WWWAnchor {
  59.             name "http://hyperreal.com/~mpesce/book/examples/second.wrl" # Another world
  60.             description "A link to another world" # Decriptive text
  61.  
  62.             # Finally, create the earth
  63.             Sphere {
  64.                 radius 2    # Little Earth
  65.             }
  66.         }
  67.  
  68.         # The Moon gets its own Separator
  69.         # Because we really do keep everything separate
  70.         Separator {
  71.  
  72.             # The Moon is just outside the Earth
  73.             Transform {
  74.                 translation 4 4 0
  75.             }
  76.  
  77.             # Color the Moon grey, make it absorb light
  78.             # It's a little shiny, but not much
  79.             Material {
  80.                 diffuseColor 0.7 0.7 0.7
  81.                 shininess 0.3
  82.             }
  83.  
  84.             # The WWWAnchor node is a group node
  85.             # This means that all objects within it are linked with the anchor's URL
  86.             # We want to link the Moon, so the Moon's Sphere node goes inside of it.
  87.             # Using the description field, we provide context for the user
  88.             # The DEF node attaches the name "Moon" to the WWWAnchor node
  89.             DEF Moon WWWAnchor {
  90.                 name "http://www.cyborganic.com:80/People/paul/The_new_dogs/pescewrd.au"
  91.                 description "Sounds from a talk about VRML"
  92.  
  93.                 # And now, create the Moon
  94.                 Sphere {
  95.                     radius 1    # Tiny Moon
  96.                 }
  97.             }
  98.         }
  99.     }
  100. }
  101.  
  102.